import request from '@/utils/request'

// 搜索售货机(售货机列表)
export const getSearchVendingList = (pageIndex, pageSize) => request({
  url: '/vm-service/vm/search',
  params: {
    pageIndex,
    pageSize
  }
})

/**
 *一定时间内的销售量
 * @param {String} start 开始时间
 * @param {String} end   结束时间
 * @param {String} innerCode 售货机编号
 * @returns
 */
export const getTimeFrameAPI = (start, end, innerCode) => request({
  url: '/order-service/report/orderCount',
  params: {
    start,
    end,
    innerCode
  }
})

/**
 *获取一定时间范围之内的收入
 * @param {String} start 开始时间
 * @param {String} end 结束时间
 * @param {String} innerCode 售货机编号
 */
// 获取一定时间范围之内的收入
export const getTimeIncomeAPI = (start, end, innerCode) => {
  return request({
    url: '/order-service/report/orderAmount',
    params: {
      start,
      end,
      innerCode
    }
  })
}

/**
 *获取售货机补货次数
 * @param {String} innerCode
 * @param {String} start
 * @param {String} end
 * @returns Promise
 */
// 获取售货机补货次数
export const getVendingNumberAPI = (innerCode, start, end) => request({
  url: `/task-service/task/supplyCount/${innerCode}/${start}/${end}`
})
// 获取售货机维修次数
export const getMaintainNumberAPI = (innerCode, start, end) => request({
  url: `/task-service/task/repairCount/${innerCode}/${start}/${end}`
})

// 获取售货机商品销量

export const getVendingSalesAPI = (innerCode, start, end) => request({
  url: `/order-service/report/skuCollect/${innerCode}/${start}/${end}`
})
